export const orderStatus = (status) => {
  const obj = {
    0: "待付款",
    1: "待配送",
    2: "待收货",
    3: "待评价"
  }
  return obj[status]
}

export const parseGoodsStatus = (goods) => {    
    var status_config = {   
        '2': {
            status: 2,
            title: '已收货'
        },
        '3': {
            status: 3,
            title: '已取消'
        },
        '4': {
            status: 4,
            title: '已完成'
        },
        '5': {
            status: 5,
            title: '已作废'
        }
    }
    if (status_config[goods.order_status]) {
        if( goods.order_status==4 && goods.is_comment == 0) {
            return {
                status: 9,
                title: '待评价'
            }
        }
        return status_config[goods.order_status]
    }

    if (goods.pay_status == 0) {
        return {
        status: 6,
        title: '待支付'
        }
    }
    if (goods.shipping_status == 0) {
        return {
        status: 1,
        title: '待发货'
        }
    }else{
        if( goods.order_status == 1){
            return {
                status: 7,
                title: '待收货'
            }
        }
    }
    return {
        status: 8,
        title: '待管理员确认'
    }
}

export const orderTime = (time) => {

    return obj[status]
}
